<template>
  <el-table :data="tableData" border style="width: 100%" size='mini' :height="height"  :header-cell-style="{ 'font-weight':'600'}">
    <el-table-column prop="address" label="物业地址" width="200" fixed align="center"></el-table-column>
    <el-table-column prop="developers" label="开发商" width="100" align="center"></el-table-column>
    <el-table-column prop="deliveryStatus" label="交付状况" width="90">
      <template scope="scope">
            <span>{{ scope.row.deliveryStatus==1?'精装':'毛坯'}}</span>
        </template>
    </el-table-column>
    <el-table-column prop="qualified" label="合格率" width="120">
        <template scope="scope">
            <span>{{ scope.row.qualified}}%</span>
        </template>
    </el-table-column>
    <el-table-column prop="province" :label="item.name" v-for="item in reportType" align="center">
      <el-table-column prop="" :label="ite.name" width="90" v-if="item.id==ite.parentId" v-for="(ite,ind) in sonType" align="center">
        <template scope="scope">
            <span>{{ scope.row.sonTypeQualifiedVoList[ind].unqualified}}</span>
        </template>
      </el-table-column>
    </el-table-column>
  </el-table>
</template>
<script>
import { request } from "../../assets/request.js";
export default {
  data() {
    return {
      tableData: [],
      sonType:[],
      reportType:[],
      obj:{
        page:1,
        size:20,
        deliveryStatus:1
      },
      height: window.innerHeight - (window.innerWidth <1366? 347 :283),//计算表格高度
    };
  },
  created(){
    this.getList(this.obj)
    this.$root.$on('searchReportData',data=>{
      if(data!='no'){
        this.obj=data
      }
      this.getList(this.obj)
    })
  },
  methods:{
    seeReport(type,row){ //查看报告
      this.$root.$emit('seeReport',type,row)
    },
    handleClick(row) {
      console.log(row);
    },
    getList(obj){ //报告模板的大类与分类
      let url = "order/report/data";
      let that=this   //解决this指向问题
      request.ajaxGet({
          url,
          that,
          params:obj,
          fn(res){
            console.log(res)
            if(res.pageInfo!=null){ //判断是否有  报告数据
              let data=res.pageInfo.list
              that.tableData=data
              let total=res.pageInfo.total
              that.$root.$emit('report',total)
            }else{
              that.tableData=[],
              that.$root.$emit('report',0)
            }
            that.reportType=res.bigList
            that.sonType=res.sonList
          }
      })
    }
  },
  
};
</script>
<style lang="less" scoped>
.star{
    background: #ff9900;
    color: #fff;
    padding: 3px 5px;
    border-radius: 2px;
    margin-right: 5px;
}
</style>

